<%-- 
    Document   : admin
    Created on : 21.Haz.2011, 13:34:44
    Author     : Ahm
--%>

<%@page contentType="text/html" pageEncoding="UTF-8" import="java.sql.*"%>
<jsp:useBean id="user" class="controls.UseBean" scope="session"/>
<%  controls.addinfo nesne4 = new controls.addinfo();

            String islem = request.getParameter("islem");
            islem = islem + " ";
            if (islem.charAt(0) == 'n' || islem.charAt(0) == ' ') {
            } else {
                if (islem.equals("Tüm Üyeleri Göster ve Hakları Ayarla ")) {
                    islem = "tum";
                }
                if (islem.equals("Yeni Üye Onayla ")) {
                    islem = "yeni";
                }
                if (islem.equals("Article Onayla ")) {
                    islem = "article";
                }

                if (islem.equals("UyeyiOnayla ")) {
                    islem = "UyeyiOnayla";
                }

            }
            if (islem.equals("UyeyiOnayla")) {
                int onayuyeid = Integer.parseInt(request.getParameter("id1"));
              
                nesne4.uyeyonetimonay(onayuyeid);
            }
System.out.println("testbas " + islem);


            if (islem.equals("articleOnay ")) {
                System.out.println("actictest1");
                int onayarticle = Integer.parseInt(request.getParameter("id1"));
                System.out.println("artictest2");
                System.out.println("onayarticle = " + onayarticle);
                nesne4.articleonay(onayarticle);
                System.out.println("artictest5");
            }


%>



<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>Admin Page</title>
</head>
<body>
    <h1>Admin Page!</h1>
    <form action="admin.jsp">
        <select name="islem">
            <option>Tüm Üyeleri Göster ve Hakları Ayarla</option>
            <option>Yeni Üye Onayla</option>
            <option>Article Onayla</option>
        </select>
        <input type="submit" value="Gönder" name="gonder" />
    </form>
<br>
<br>
<br>
<br>
<br>
    <h2>GENEL AYARLAR</h2>
    <form action="admin.jsp">
    Site İsmi:  <input type="text" name="siteismi" value="" /> <br>
    Üye Alımı Yapılsın mı?:<select name="uyealimi">
        <option>Evet</option>
        <option>Hayır-Üye Alımını</option>
    </select><br>
    Duyuru1=<input type="text" name="duyuru1" value="" /><br>
    Duyuru2=<input type="text" name="duyuru2" value="" /><br>
    Anasayfabilgi1=<input type="text" name="anasayfabilgi1" value="" /><br>
    Anasayfabilgi2=<input type="text" name="anasayfabilgi2" value="" /><br>
    Anasayfabilgi3=<input type="text" name="anasayfabilgi3" value="" /><br>
    Anasayfabilgi4=<input type="text" name="anasayfabilgi4" value="" /><br>


   <input type="submit" value="Kaydet" name="genelayarkaydet" />
</form>
<%
                try {





                        if (islem.equals("tum")) {
                        controls.SQLConnection sqlconnect = new controls.SQLConnection();
                        Statement komut = sqlconnect.GetDiscoussionConnection();
                        Statement komut2 = sqlconnect.GetDiscoussionConnection();
                        ResultSet sonuc = komut.executeQuery("SELECT * FROM usertable");
                        ResultSet sonuc2 = komut2.executeQuery("SELECT * FROM profiltable");
                        out.println("<p>USERTABLE</p>");
    %>
    <table border="1" width="100%">
        <tr>
            <td><input type="text" name="id" value="id" /></td>
    <td><input type="text" name="id1" value="öğrenci numarası" /></td>
<td><input type="text" name="id2" value="kullanıcıadı"/></td>
<td><input type="text" name="id3" value="şifre" /></td>
<td><input type="text" name="id4" value="Real name" /></td>
<td><input type="text" name="id5" value="Authority" /></td>
<td><input type="text" name="id6" value="LastLoginDate" /></td>
<td><input type="text" name="id7" value="Email confirmation" /></td>
</tr>

<%
                        while (sonuc.next()) {
%>
<tr>
    <td><input type="text" name="id" value="<%=sonuc.getString(1)%>" /></td>
<td><input type="text" name="id1" value="<%=sonuc.getString(2)%>" /></td>
<td><input type="text" name="id2" value="<%=sonuc.getString(3)%>" /></td>
<td><input type="text" name="id3" value="**gizli**" /></td>
<td><input type="text" name="id4" value="<%=sonuc.getString(5)%>" /></td>
<td><input type="text" name="id5" value="<%=sonuc.getString(6)%>" /></td>
<td><input type="text" name="id6" value="<%=sonuc.getString(7)%>" /></td>
<td><input type="text" name="id7" value="<%=sonuc.getString(8)%>" /></td>
</tr>
</table>
<%
                        }
%>
<br>
<br>
<br>
<br>
<br>
PROFİL TABLE
<%

                        while (sonuc2.next()) {
%>

<table border="1" width="100%">
    <tr>
        <td><input type="text" name="id" value="<%=sonuc2.getString(1)%>" /></td>
<td><input type="text" name="id1" value="<%=sonuc2.getString(2)%>" /></td>
<td><input type="text" name="id2" value="<%=sonuc2.getString(3)%>" /></td>
<td><input type="text" name="id3" value="<%=sonuc2.getString(4)%>" /></td>
<td><input type="text" name="id4" value="<%=sonuc2.getString(5)%>" /></td>
<td><input type="text" name="id5" value="<%=sonuc2.getString(6)%>" /></td>
<td><input type="text" name="id6" value="<%=sonuc2.getString(7)%>" /></td>
<td><input type="text" name="id7" value="<%=sonuc2.getString(8)%>" /></td>
</tr>
</table>
<%
                        }
                    } else if (islem.equals("yeni")) {
                        out.println("yeni üye onay sayfası");
                        controls.SQLConnection sqlconnect = new controls.SQLConnection();
                        Statement komut = sqlconnect.GetDiscoussionConnection();
                        ResultSet sonuc2 = komut.executeQuery("SELECT * FROM usertable WHERE AdminConfirmation='2' and EmailConfirmation='1'");
                        while (sonuc2.next()) {
%>
<form action="admin.jsp">

    <table border="1" width="100%">
        <tr>
            <td><input type="text" name="id1" value="<%=sonuc2.getString(1)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(2)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(3)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(5)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(6)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(8)%>" /></td>
        <td><input type="submit" value="UyeyiOnayla" name="islem" /></td>


        </tr></table>
</form>
<%
                    }
                }

                if (islem.equals("article")) {
                   out.println("article onay sayfası");
                        controls.SQLConnection sqlconnect = new controls.SQLConnection();
                        Statement komut = sqlconnect.GetDiscoussionConnection();
                        ResultSet sonuc2 = komut.executeQuery("SELECT * FROM articletable WHERE `Check` = 1");
while(sonuc2.next()){
                        %>
<form action="admin.jsp">

    <table border="1" width="100%">
        <tr>
            <td><input type="text" name="id1" value="<%=sonuc2.getString(1)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(2)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(3)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(5)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(6)%>" /></td>
        <td><input type="text" name="id" value="<%=sonuc2.getString(9)%>" /></td>
        <td><input type="submit" value="articleOnay" name="islem" /></td>


        </tr></table>
</form



<%
                }}





            } catch (Exception e) {
            }

%>



</body>
</html>
